var appFunc = require('../utils/appFunc');
var xhr = require('../utils/xhr');
require('./bundlewechat.less');

module.exports = {
    init: function(){
        appFunc.hideToolbar();

        this.bindEvents();
    },
    sendFeedback: function(){
    	
        hiApp.showPreloader(i18n.index.sending);
        setTimeout(function(){
            hiApp.hidePreloader();
            hiApp.alert("您已绑定成功",["微信绑定"]);
        },1000);
    },
    postUserDate:function(){
    	var formdata = hiApp.formToJSON("#wechatform");
    	xhr.simpleCallForXWL(formdata,sendFeedback);
    	
    },
    bindEvents: function(){
    /*    var bindings = [{
            element: '.send-user',
            event: 'click',
            handler: this.sendFeedback
        }];*/

        appFunc.bindEvents(bindings);
        
        var submits = [{
        	element:'#subbtn',
        	event:'click',
        	handler:this.postUserDate
        }];
        
        appFunc.bindEvents(submits);
        
    }
};